cmake_minimum_required(VERSION 3.10.2)

project("Demo")

# 设置生成的so动态库最后输出的路径
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../jniLibs/${ANDROID_ABI})

#设置头文件搜索路径（和此txt同个路径的头文件无需设置），可选
include_directories()

file(GLOB jni "*.cpp")

add_library( # Sets the name of the library.  设置库的名称。
        Demo

        # Sets the library as a shared library. 将library设置为一个共享库
        SHARED

        # Provides a relative path to your source file(s).为源文件提供一个相对路径
        ${jni}
        )


find_library( # Sets the name of the path variable. 设置路径变量的名称
        log-lib

        # Specifies the name of the NDK library that 指定NDK库的名称
        # you want CMake to locate.
        log
        )


target_link_libraries( # Specifies the target library.指定目标library中。
        Demo

        # Links the target library to the log library  将目标library链接到日志库
        # included in the NDK.
        ${log-lib}
        )


# 头文件输出
#file(GLOB resrtmp_hdrs "src/main/jni/rtmp/*.h")
#file(COPY  ${resrtmp_hdrs}
#        DESTINATION  "${PROJECT_SOURCE_DIR}/../libs/resrtmp/include"  )

# file(GLOB librtmp_hdrs "src/main/jni/rtmp/librtmp/*.h")
#file(COPY  ${librtmp_hdrs}
#        DESTINATION  "${PROJECT_SOURCE_DIR}/../libs/resrtmp/include/librtmp"  )
